/*     */ package com.lmpop.trade.ti_channel;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import java.util.Hashtable;
/*     */ import java.util.Iterator;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class Ti_channelInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/* 527 */   StringBuffer beforeStr = new StringBuffer();
/* 528 */   StringBuffer ch_attrx = new StringBuffer();
/*     */ 
/*     */   public Ti_channelInfo()
/*     */   {
/*  17 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  26 */     Ti_channel ti_channel = new Ti_channel();
/*  27 */     ti_channel.setCh_id(map.getString("ch_id"));
/*  28 */     ti_channel.setWeb_id(map.getString("web_id"));
/*  29 */     ti_channel.setCh_name(map.getString("ch_name"));
/*  30 */     ti_channel.setUp_ch_id(map.getString("up_ch_id"));
/*  31 */     ti_channel.setCh_level(map.getString("ch_level"));
/*  32 */     ti_channel.setSave_dir(map.getString("save_dir"));
/*  33 */     ti_channel.setDefault_page(map.getString("default_page"));
/*  34 */     ti_channel.setSort(map.getString("sort"));
/*  35 */     ti_channel.setIndex_temp(map.getString("index_temp"));
/*  36 */     ti_channel.setOut_link(map.getString("out_link"));
/*  37 */     ti_channel.setMeta_keyword(map.getString("meta_keyword"));
/*  38 */     ti_channel.setMeta_desc(map.getString("meta_desc"));
/*  39 */     ti_channel.setRemark(map.getString("remark"));
/*  40 */     ti_channel.setIn_date(map.getString("in_date"));
/*     */ 
/*  42 */     String result_code = "0";
/*     */     try {
/*  44 */       insert(dbmMgr, ti_channel);
/*     */     } catch (ApplicationException e) {
/*  46 */       e.printStackTrace();
/*  47 */       result_code = "1";
/*     */     }
/*  49 */     map.setString("result_code", result_code);
/*  50 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ti_channel ti_channel)
/*     */     throws ApplicationException
/*     */   {
/*  59 */     dbmMgr.update("insertTi_channel", ti_channel);
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  69 */     String pkid_string = map.getString("pkid");
/*  70 */     String result_code = "0";
/*     */     try {
/*  72 */       if (!pkid_string.equals("")) {
/*  73 */         String[] pkStr = pkid_string.split("\\|");
/*  74 */         for (int i = 0; i < pkStr.length; i++) {
/*  75 */           if (pkStr[i].equals("")) continue; delete(dbmMgr, pkStr[i]);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/*  79 */       e.printStackTrace();
/*  80 */       result_code = "1";
/*     */     }
/*  82 */     map.setString("result_code", result_code);
/*  83 */     map.setString("attach_root_id", pkid_string);
/*  84 */     map.setString("attach_sign", "delete");
/*  85 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/*  94 */     dbmMgr.update("deleteTi_channel", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/* 103 */     Ti_channel ti_channel = new Ti_channel();
/* 104 */     ti_channel.setCh_id(map.getString("ch_id"));
/* 105 */     ti_channel.setWeb_id(map.getString("web_id"));
/* 106 */     ti_channel.setCh_name(map.getString("ch_name"));
/* 107 */     ti_channel.setMeta_keyword(map.getString("meta_keyword"));
/* 108 */     ti_channel.setMeta_desc(map.getString("meta_desc"));
/* 109 */     ti_channel.setUp_ch_id(map.getString("up_ch_id"));
/* 110 */     ti_channel.setCh_level(map.getString("ch_level"));
/* 111 */     ti_channel.setSave_dir(map.getString("save_dir"));
/* 112 */     ti_channel.setDefault_page(map.getString("default_page"));
/* 113 */     ti_channel.setSort(map.getString("sort"));
/* 114 */     ti_channel.setIndex_temp(map.getString("index_temp"));
/* 115 */     ti_channel.setOut_link(map.getString("out_link"));
/* 116 */     ti_channel.setRemark(map.getString("remark"));
/* 117 */     ti_channel.setIn_date(map.getString("in_date"));
/*     */ 
/* 119 */     String result_code = "0";
/*     */     try {
/* 121 */       update(dbmMgr, ti_channel);
/*     */     } catch (ApplicationException e) {
/* 123 */       e.printStackTrace();
/* 124 */       result_code = "1";
/*     */     }
/* 126 */     map.setString("result_code", result_code);
/* 127 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ti_channel ti_channel)
/*     */     throws ApplicationException
/*     */   {
/* 136 */     dbmMgr.update("updateTi_channel", ti_channel);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 148 */     Ti_channel ti_channel = (Ti_channel)obj;
/* 149 */     if (start == 0)
/* 150 */       start = 0;
/*     */     else {
/* 152 */       start = (start - 1) * limit;
/*     */     }
/* 154 */     ti_channel.setStart(Integer.valueOf(start));
/* 155 */     ti_channel.setLimit(Integer.valueOf(limit));
/* 156 */     return this.queryList.getList("getListByPage", ti_channel);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 168 */     Ti_channel ti_channel = (Ti_channel)obj;
/* 169 */     List list = this.queryList.getList("selTi_channelSum", ti_channel);
/*     */ 
/* 171 */     int count = 0;
/* 172 */     if ((list != null) && (list.size() > 0)) {
/* 173 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 174 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 175 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 178 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 189 */     return this.queryList.getList("getTi_channelByPk", pk);
/*     */   }
/*     */ 
/*     */   public String getUp_ch_id(String ch_id)
/*     */   {
/* 200 */     String up_ch_id = "";
/* 201 */     List Idlist = this.queryList.getList("getUp_ch_id", ch_id);
/* 202 */     if ((Idlist != null) && (Idlist.size() > 0)) {
/* 203 */       Map chmap = (Hashtable)Idlist.get(0);
/* 204 */       if (chmap.get("up_ch_id") != null)
/*     */       {
/* 206 */         up_ch_id = chmap.get("up_ch_id").toString();
/*     */       }
/*     */     }
/* 209 */     return up_ch_id;
/*     */   }
/*     */ 
/*     */   public String getTreeUpId(String ch_id) {
/* 213 */     String up_id = "";
/* 214 */     StringBuffer up_ids = new StringBuffer();
/* 215 */     List Idlist = this.queryList.getList("getUp_ch_id", ch_id);
/* 216 */     if ((Idlist == null) || (Idlist.size() <= 0)) return "";
/* 217 */     for (Iterator it = Idlist.iterator(); it.hasNext(); ) {
/* 218 */       Hashtable map = (Hashtable)it.next();
/* 219 */       if (map.get("up_ch_id") != null) {
/* 220 */         up_id = map.get("up_ch_id").toString();
/* 221 */         if (up_id.equals("000000000000000")) break;
/* 222 */         up_ids.append(up_id + "|");
/* 223 */         up_ids.append(getTreeUpId(up_id));
/*     */       }
/*     */     }
/*     */ 
/* 227 */     return up_ids.toString();
/*     */   }
/*     */ 
/*     */   public String getUpFilePath(String ch_id)
/*     */   {
/* 237 */     String save_dir = "";
/* 238 */     List Idlist = this.queryList.getList("getSaveDir", ch_id);
/* 239 */     if ((Idlist != null) && (Idlist.size() > 0)) {
/* 240 */       Map map = (Hashtable)Idlist.get(0);
/* 241 */       if (map.get("save_dir") != null)
/* 242 */         save_dir = map.get("save_dir").toString();
/*     */     }
/* 244 */     return save_dir;
/*     */   }
/*     */ 
/*     */   public String getUpChannelLevel(String ch_id)
/*     */   {
/* 254 */     String ch_level = "";
/* 255 */     List Idlist = this.queryList.getList("getUpChannelLevel", ch_id);
/* 256 */     if ((Idlist != null) && (Idlist.size() > 0)) {
/* 257 */       Map map = (Hashtable)Idlist.get(0);
/* 258 */       if (map.get("ch_level") != null)
/* 259 */         ch_level = map.get("ch_level").toString();
/*     */     }
/* 261 */     return ch_level;
/*     */   }
/*     */ 
/*     */   public String getSelfChannelLevel(String ch_id)
/*     */   {
/* 271 */     String ch_level = "";
/* 272 */     List Idlist = this.queryList.getList("getSelfChannelLevel", ch_id);
/* 273 */     Map map = (Hashtable)Idlist.get(0);
/* 274 */     if (map.get("ch_level") != null)
/* 275 */       ch_level = map.get("ch_level").toString();
/* 276 */     return ch_level;
/*     */   }
/*     */ 
/*     */   public String getChName(String ch_id)
/*     */   {
/* 286 */     String ch_name = "";
/* 287 */     List namelist = this.queryList.getList("getChName", ch_id);
/* 288 */     if ((namelist != null) && (namelist.size() > 0)) {
/* 289 */       Hashtable map = (Hashtable)namelist.get(0);
/* 290 */       if (map.get("ch_name") != null)
/* 291 */         ch_name = map.get("ch_name").toString();
/*     */     }
/* 293 */     return ch_name;
/*     */   }
/*     */ 
/*     */   public int getBooChSon(String ch_id)
/*     */   {
/* 304 */     int g = 0;
/* 305 */     List list = this.queryList.getList("getBooChSon", ch_id);
/* 306 */     if ((list != null) && (list.size() > 0))
/* 307 */       g = 1;
/* 308 */     return g;
/*     */   }
/*     */ 
/*     */   public String getSelchannelByTLevel(String level)
/*     */   {
/* 318 */     Ti_channel ti_channel = new Ti_channel();
/* 319 */     String select = "";
/* 320 */     ti_channel.setCh_level(level);
/* 321 */     List list = this.queryList.getList("getSelchannelByTLevel", ti_channel);
/* 322 */     if ((list != null) && (list.size() > 0)) {
/* 323 */       for (int i = 0; i < list.size(); i++) {
/* 324 */         Hashtable map = (Hashtable)list.get(i);
/* 325 */         String id = ""; String text = "";
/* 326 */         if (map.get("ch_id") != null) {
/* 327 */           id = map.get("ch_id").toString();
/*     */         }
/* 329 */         if (map.get("ch_name") != null) {
/* 330 */           text = map.get("ch_name").toString();
/*     */         }
/* 332 */         select = select + "<option value=" + id + ">" + text + "</option>";
/*     */       }
/*     */     }
/* 335 */     return select;
/*     */   }
/*     */ 
/*     */   public Map getChClassByUpId(String upclass)
/*     */   {
/* 345 */     Ti_channel ti_channel = new Ti_channel();
/* 346 */     ti_channel.setUp_ch_id(upclass);
/* 347 */     Map classMap = new Hashtable();
/* 348 */     String class_id = ""; String class_name = "";
/* 349 */     List list = this.queryList.getList("getChClassByUpId", ti_channel);
/* 350 */     if ((list != null) && (list.size() > 0)) {
/* 351 */       for (int i = 0; i < list.size(); i++) {
/* 352 */         Hashtable map = (Hashtable)list.get(i);
/* 353 */         if (map.get("ch_name") != null) {
/* 354 */           class_name = map.get("ch_name").toString();
/*     */         }
/* 356 */         if (map.get("ch_id") != null) {
/* 357 */           class_id = map.get("ch_id").toString();
/*     */         }
/*     */ 
/* 360 */         classMap.put(class_id, class_name);
/*     */       }
/*     */     }
/*     */ 
/* 364 */     return classMap;
/*     */   }
/*     */ 
/*     */   public Map getChNameBymap()
/*     */   {
/* 373 */     Map chMap = new Hashtable();
/* 374 */     String class_id = ""; String class_name = "";
/* 375 */     List list = this.queryList.getList("getChNameById");
/* 376 */     if ((list != null) && (list.size() > 0)) {
/* 377 */       for (int i = 0; i < list.size(); i++) {
/* 378 */         Hashtable map = (Hashtable)list.get(i);
/* 379 */         if (map.get("ch_name") != null) {
/* 380 */           class_name = map.get("ch_name").toString();
/*     */         }
/* 382 */         if (map.get("ch_id") != null) {
/* 383 */           class_id = map.get("ch_id").toString();
/*     */         }
/*     */ 
/* 386 */         chMap.put(class_id, class_name);
/*     */       }
/*     */     }
/* 389 */     return chMap;
/*     */   }
/*     */ 
/*     */   public String getChannelSelectAll(String checkId)
/*     */   {
/* 399 */     List bList = this.queryList.getList("getChannnelSelectAll", "");
/* 400 */     StringBuffer select = new StringBuffer();
/* 401 */     if ((null != bList) && (bList.size() > 0)) {
/* 402 */       for (int i = 0; i < bList.size(); i++) {
/* 403 */         String info_id = ""; String title = "";
/* 404 */         Hashtable bMap = (Hashtable)bList.get(i);
/* 405 */         if (bMap.get("ch_id") != null)
/*     */         {
/* 407 */           info_id = bMap.get("ch_id").toString();
/*     */         }
/* 409 */         if (bMap.get("ch_name") != null)
/*     */         {
/* 411 */           title = bMap.get("ch_name").toString();
/*     */         }
/* 413 */         if (checkId.equals(info_id))
/* 414 */           select.append("<option value='" + info_id + "' selected>" + title + "</option>");
/*     */         else {
/* 416 */           select.append("<option value='" + info_id + "'>" + title + "</option>");
/*     */         }
/*     */       }
/*     */     }
/* 420 */     return select.toString();
/*     */   }
/*     */ 
/*     */   public String getChannelToSelect(String type, String ch_id, String cust_id, String ch_name)
/*     */   {
/* 433 */     String selectItems = "<select name=\"" + type + "_select1\" id=\"" + type + "_select1\" size=\"10\" style=\"width:90%\" multiple=\"true\">";
/* 434 */     Ti_channel ti_channel = new Ti_channel();
/* 435 */     if (!ch_id.equals("")) ti_channel.setCh_id(ch_id);
/* 436 */     if (!cust_id.equals("")) ti_channel.setCust_id(cust_id);
/* 437 */     if (!ch_name.equals("")) ti_channel.setCh_name(ch_name);
/*     */ 
/* 439 */     List list = this.queryList.getList("getChannelToSelect", ti_channel);
/* 440 */     if ((list != null) && (list.size() > 0)) {
/* 441 */       for (int i = 0; i < list.size(); i++) {
/* 442 */         Hashtable map = (Hashtable)list.get(i);
/* 443 */         String g_ch_id = ""; String s_ch_name = "";
/* 444 */         if (map.get("ch_id") != null) {
/* 445 */           g_ch_id = map.get("ch_id").toString();
/*     */         }
/* 447 */         if (map.get("ch_name") != null) {
/* 448 */           s_ch_name = map.get("ch_name").toString();
/*     */         }
/* 450 */         selectItems = selectItems + "<option value='" + g_ch_id + "'>" + s_ch_name + "</option>";
/*     */       }
/*     */     }
/*     */ 
/* 454 */     selectItems = selectItems + "</select>";
/* 455 */     return selectItems;
/*     */   }
/*     */ 
/*     */   public List getchannelListForTable(String ch_id, String ch_name)
/*     */   {
/* 468 */     Ti_channel ti_channel = new Ti_channel();
/* 469 */     if (!ch_id.equals("")) ti_channel.setCh_id(ch_id);
/* 470 */     if (!ch_name.equals("")) ti_channel.setCh_name(ch_name);
/* 471 */     return this.queryList.getList("getchannelListForTable", ti_channel);
/*     */   }
/*     */ 
/*     */   public String getChannelTreeByTLevel(String ch_id)
/*     */   {
/* 484 */     Ti_channel ti_channel = new Ti_channel();
/* 485 */     String select = "";
/* 486 */     String ch_idx = ""; String text = ""; String ch_level = "";
/* 487 */     ti_channel.setCh_id(ch_id);
/* 488 */     List list = this.queryList.getList("getChannelTreeByTLevel", ti_channel);
/* 489 */     if ((list != null) && (list.size() > 0)) {
/* 490 */       for (int i = 0; i < list.size(); i++) {
/* 491 */         Hashtable map = (Hashtable)list.get(i);
/*     */ 
/* 493 */         if (map.get("ch_id") != null) {
/* 494 */           ch_idx = map.get("ch_id").toString();
/*     */         }
/* 496 */         if (map.get("ch_name") != null) {
/* 497 */           text = map.get("ch_name").toString();
/*     */         }
/* 499 */         if (map.get("ch_level") != null) {
/* 500 */           ch_level = map.get("ch_level").toString();
/*     */         }
/* 502 */         String line = "";
/* 503 */         for (int j = 1; j < Integer.parseInt(ch_level); j++)
/*     */         {
/* 505 */           line = line + "&nbsp;&nbsp;";
/*     */         }
/* 507 */         if (getBooChSon(ch_idx) == 0) {
/* 508 */           select = select + "<option value=" + ch_idx + ">" + line + text + "</option>";
/*     */         } else {
/* 510 */           select = select + "<option value=" + ch_idx + ">" + line + text + "</option>";
/* 511 */           select = select + getChannelTreeByTLevel(ch_idx);
/*     */         }
/*     */       }
/*     */     }
/* 515 */     return select;
/*     */   }
/*     */ 
/*     */   public String getChannelTree(String ch_id)
/*     */   {
/* 531 */     Ti_channel ti_channel = new Ti_channel();
/* 532 */     StringBuffer select = new StringBuffer();
/* 533 */     String ch_idx = ""; String ch_name = ""; String ch_level = ""; String ch_attr = "";
/* 534 */     ti_channel.setCh_id(ch_id);
/* 535 */     List list = this.queryList.getList("getChannelTreeByTLevel", ti_channel);
/* 536 */     if ((list != null) && (list.size() > 0)) {
/* 537 */       for (int i = 0; i < list.size(); i++) {
/* 538 */         Hashtable map = (Hashtable)list.get(i);
/* 539 */         if (map.get("ch_id") != null) ch_idx = map.get("ch_id").toString();
/* 540 */         if (map.get("ch_name") != null) ch_name = map.get("ch_name").toString();
/* 541 */         if (map.get("ch_level") != null) ch_level = map.get("ch_level").toString();
/* 542 */         String ch_tr = ""; StringBuffer trr = new StringBuffer();
/* 543 */         ch_tr = ch_idx + "|" + getTreeUpId(ch_idx);
/* 544 */         if (!ch_tr.equals("")) {
/* 545 */           String[] tr = ch_tr.split("\\|");
/* 546 */           for (int j = tr.length - 1; j >= 0; j--) {
/* 547 */             trr.append(tr[j] + "|");
/*     */           }
/*     */         }
/* 550 */         String line = "";
/* 551 */         for (int j = 1; j < Integer.parseInt(ch_level); j++)
/*     */         {
/* 553 */           line = line + "&nbsp;&nbsp;";
/*     */         }
/* 555 */         if (getBooChSon(ch_idx) == 0) {
/* 556 */           select.append("<option value=" + trr.toString() + ">" + line + ch_name + "</option>");
/*     */         } else {
/* 558 */           select.append("<option value=" + trr.toString() + ">" + line + ch_name + "</option>");
/* 559 */           select.append(getChannelTree(ch_idx));
/*     */         }
/*     */       }
/*     */     }
/*     */ 
/* 564 */     return select.toString();
/*     */   }
/*     */ 
/*     */   public int getBooChannelSon(String ch_id)
/*     */   {
/* 576 */     List list = this.queryList.getList("checkchannel", ch_id);
/* 577 */     if ((list != null) && (list.size() > 0)) {
/* 578 */       return 1;
/*     */     }
/* 580 */     return 0;
/*     */   }
/*     */ 
/*     */   public List getChannelByUpId(String upclass)
/*     */   {
/* 591 */     Ti_channel ti_channel = new Ti_channel();
/* 592 */     ti_channel.setUp_ch_id(upclass);
/* 593 */     List list = this.queryList.getList("getChClassByUpId", ti_channel);
/*     */ 
/* 595 */     return list;
/*     */   }
/*     */ 
/*     */   public Map getAllChClass()
/*     */   {
/* 607 */     Ti_channel ti_channel = new Ti_channel();
/* 608 */     Map classMap = new Hashtable();
/* 609 */     String class_id = ""; String class_name = "";
/* 610 */     List list = this.queryList.getList("getAllChClassByNothing", ti_channel);
/* 611 */     if ((list != null) && (list.size() > 0)) {
/* 612 */       for (int i = 0; i < list.size(); i++) {
/* 613 */         Hashtable map = (Hashtable)list.get(i);
/* 614 */         if (map.get("ch_name") != null) {
/* 615 */           class_name = map.get("ch_name").toString();
/*     */         }
/* 617 */         if (map.get("ch_id") != null) {
/* 618 */           class_id = map.get("ch_id").toString();
/*     */         }
/*     */ 
/* 621 */         classMap.put(class_id, class_name);
/*     */       }
/*     */     }
/*     */ 
/* 625 */     return classMap;
/*     */   }
/*     */ 
/*     */   public Boolean checkSonById(String pk)
/*     */   {
/* 630 */     List catList = this.queryList.getList("check_ch_Son", pk);
/* 631 */     if ((catList != null) && (catList.size() > 0)) {
/* 632 */       return Boolean.valueOf(true);
/*     */     }
/* 634 */     return Boolean.valueOf(false);
/*     */   }
/*     */ 
/*     */   public Boolean checkChannelName(String ch_name) {
/* 638 */     List list = this.queryList.getList("ti_channel_checkChannelName", ch_name);
/* 639 */     if ((list != null) && (list.size() > 0)) {
/* 640 */       return Boolean.valueOf(true);
/*     */     }
/* 642 */     return Boolean.valueOf(false);
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ti_channel.Ti_channelInfo
 * JD-Core Version:    0.6.0
 */